#pragma once
#include "../CGIResource.h"
namespace Alice
{
    class VulkanDevice;
    class VulkanShader
    {
    public:
        VulkanDevice*                   mDevice;
        const EShaderFrequency			mFrequency;
        VkShaderModule                  mShaderModule;
        static std::unordered_map<std::string,VulkanShader*> mCachedShaders;
        VulkanShader(VulkanDevice*inDevice,EShaderFrequency inFrequency,unsigned char* inCode,int32 inCodeSizeLen);
    };
    template<typename BaseResourceType, EShaderFrequency ShaderType>
    class TVulkanBaseShader : public BaseResourceType, public VulkanShader
    {
    public:
        enum { StaticFrequency = ShaderType };
        TVulkanBaseShader(VulkanDevice*inDevice,unsigned char* inCode,int32 inCodeSizeLen):VulkanShader(inDevice,ShaderType,inCode,inCodeSizeLen)
        {
        }
    };
    typedef TVulkanBaseShader<CGIVertexShader, SF_Vertex>				VulkanVertexShader;
    typedef TVulkanBaseShader<CGIPixelShader, SF_Pixel>				    VulkanPixelShader;

    template<typename T>
    T*GetOrCreateVulkanShader(VulkanDevice*inDevice,const char *inShaderPath,unsigned char* inCode, int32 inCodeByteLen);
}